<?php
//
//  VictoryCMS - Content managment system and framework.
//  Copyright (C) 2009  Lewis Gunsch
//
//  This file is part of VictoryCMS.
//  
//  VictoryCMS is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  VictoryCMS is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with VictoryCMS.  If not, see <http://www.gnu.org/licenses/>.

/**
 * VictoryCMS - ComponentFactory
 * 
 * @license http://www.gnu.org/licenses/gpl.html
 * @author Lewis Gunsch
 * @filesource
 * @package Components
 */

/**
 * This create's instances of Component.
 * 
 * @package Components
 * 
 * @todo Factory should get object list from an xml list - Settings.xml
 * @todo Add in method to list available components
 */
class ComponentFactory {
	/**
	 * Creates a new Component of the subtype class 
	 * $name and returns the object.
	 * 
	 * @param The component class to create
	 * @return Component The created Component object
	 */
	public static function createComponent($name, $id) {
		switch ($name) {
        		case "DocumentManager" : return new DocumentManager($id); break;
        		case "ErrorManager" : return new ErrorManager($id); break;
        		default : return null;
        	}
	}
}
?>
